I. Field of the Invention
The present invention relates to a non-cyclic or finite-impulse response (FIR) type digital filter for filtering digital image data
II. Description of the Related Art
A non-cyclic type digital filter is known in the art as a means for processing digital image data at high speed. Digital filters include one-dimensional digital filters whose filter operation area is many lines times 1 tap, and two-dimensional digital filters whose filter operation area is many lines times many taps In the following example, a two-dimensional digital filter will be described.
A filter constant, which will be multiplied during a filter operation, is preset according to a pixel position within a given filter area In a symmetric, non-cyclic type digital filter, filter constants corresponding to pixel position symmetric about the center of an image are set to the same value.
FIG. 8 shows a filter constant correspondence table for a filter operation area of 5 lines.times.5 taps. In the figure, reference characters a to f designate respective filter constants. Filter constants having the same values are given to positions symmetric about the center of the image.
FIG. 9 shows an example of image data within a filter operation area of 5 lines.times.5 taps. Each image data is multiplied by a corresponding filter constant shown in FIG. 8 (e.g., image data I.sub.11 is multiplied by a, I.sub.12 by b, . . .) and these products are added to provide a filter output.
A conventional, symmetric, non-cyclic type, two-dimensional digital filter is shown in FIG. 2. Referring to FIG. 2, reference numeral 1 designates an input terminal; 11 to 14, line buffers; 15 to 19, input latches; 20, 21, adders; 31 to 45, matrix latches; 51 to 56, adders; 61 to 66, addition unit latches; 67 to 72, multipliers; 73 to 78, processing unit latches; 79, an addition circuit; 80, an output latch; 81, an output terminal; reference character L designates a latch unit; M, an input processing unit; N, an addition unit; and R, a filter processing unit.
As an example of filter operation, it is assumed that the image data of FIG. 9 are input into terminal 1 of FIG. 2. Starting with the first line data "I.sub.11, I.sub.12, I.sub.13, I.sub.14, I.sub.15, " the image data are input sequentially on a line basis. The data are temporarily stored in one line buffer per line and are sequentially updated every time the data of the following line are applied. At the point in time when image data corresponding to the 4th line have been input, line buffer 11 contains image data of the first line; line buffer 12 contains image data of the second line; line buffer 13 contains image data of the third line; and line buffer 14 contains image data of the 4th line.
Upon application of image data corresponding to the fifth line the image data of the respective lines are simultaneously transferred to the input latches 15 to 19. Thereafter, adders 20 and 21 add the image data of symmetric lines within the filter operation area (i.e., lines in symmetric positions such as the first line and the fifth line, and the second line and the 4th line) on a tap basis and the sum is sequentially transferred to the latch unit L. Since the third line has no symmetric line, the value of each tap is simply transferred to the latch unit L without any addition.
The matrix latches 31 to 45 latch the sequentially transferred values. Reference characters A to F marked within the respective blocks of the matrix latches 31 to 45 indicate that the image data to be multiplied by the respective filter constants a to f are loaded when all the image data in the 5.times.5 filter area of (see FIG. 9) have been transferred to the latch unit L.
The addition unit N adds respective pairs of image data which will be multiplied by a common filter constant. For example, adder 51 adds the image data which will be multiplied by the filter constant a. Accordingly, adder 51 is wired to add the values of matrix latches 31 and 35. Following this addition operation, respective addition unit sums are latched by the addition unit latches 61 to 66.
At the filter processing unit R, the addition unit sums are multiplied by respective filter constants a to f using the multipliers 67 to 72. The products are latched by the processing unit latches 73 to 78 and then added by the addition circuit 79. The addition circuit sum (final sum) is latched by an output latch 80 and is then taken out from the output terminal 81 as a filter output.
Since this final sum is the filter output for the image data input at the terminal 1, the output must be data having the same format as the input image data. Image data is generally represented in "integer" form. Accordingly, the digital filter's output must also be in integer form and have the same number of bits as the input image data applied to the terminal 1. For example, if the image data applied to the terminal 1 has 8 bits, then the corresponding filter output must have the same 8 bit format. Therefore, even if the final sum obtained at the addition circuit 79 is a value other than 8 bits, such as a final sum including a decimal fraction, only the 8 bits constituting the integer portion (bits placed at the left of the decimal point) are taken out as an output.
Conventional digital filters are further disclosed in Japanese Patent Application No. 63-50101 and No. 63-95345.
Conventional digital filters typically have respective filter constants with fixed decimal point formats. As such, conventional digital filters are limited to certain pre-defined filter operations. For example, if a digital filter having the decimal point format set for a high-pass filter operation is used as a low-pass filter operation, or vice versa, the output of the digital filter is so inaccurate that it is useless.
Problems associated with conventional digital filters can be illustrated by considering a case where the filter constant decimal point format is set for a high-pass filter operation. The number of digits used to represent a filter constant is allocated at the time the device is designed. In order to determine where the decimal point should be placed within a given set of digits it is necessary to consider to the size of the filter constant which will be used during filter operation.
Since the high-pass filter operation will emphasize the middle portion of the image data, a set of filter constants will be selected in which the value of filter constant f is the largest since the area corresponding to f is at the center of the image area shown in FIG. 8. Since the sum of all the filter constants must be 1, the other filter constants will be negative or less than the value selected for f.
Therefore, a digital filter to be used in a high-pass filter operation requires a format in which the decimal point be placed such that a larger number of digits (the number of bits in binary system) will be allocated to the left of the decimal point to represent a large value for f.
FIG. 3 is a diagram showing a filter operation using filter constants represented to 2 decimal places. Reference character A designates image data to be multiplied by the respective filter constants. Assuming, for example, that 8-bit image data is input, the addition at the addition unit N following the operation at the input processing unit M in FIG. 1 would increase the number of bits of the input data. In this example, the increased number of bits will be assumed to be 11. Reference character B designates a filter constant. The header bit S is a sign bit for identifying whether the filter constant is positive or negative. A sign bit value of 0 positive, while a sign bit value of 1, means that the filter constant is negative. Reference character P designates the decimal point. Five digits at the left of the decimal point allow a large value for f to be represented.
In FIG. 3, reference character C designates the product of the above-described values A and B (the products obtained by the multipliers 67 to 72 in FIG. 2). The decimal point P is placed in the same position as in the filter constant B. Since this is a multiplication of 11 bits and 8 bits, the number of calculated bits (digits) of the whole product is, in theory, 19 bits including those bits indicated by the broken line. However, the number of bits of the digital filter's output (filtered image data) must coincide with the number of bits of the input image data (e.g., 8 bits). Therefore, an operation which cuts the calculated bits down to a number of bits sufficient to represent the digital filter's required output formal must be added to the series of filter operations. FIG. 3 shows a case where the number of bits are cut to 16.
Reference character D in FIG. 3 designates a digital filter output format to be obtained from the output terminal 81 of FIG. 2. Assuming that the data applied to terminal 1 in FIG. 2 is image data and that the image data is expressed in integer form, the digital filter must output a format in the form of an integer having the same number of bits as the input image data. In other words, the result of the digital filter operation including all multiplication and addition operations must be subjected to an additional operation which retrieves a number of bits from the calculated bits corresponding to an integer portion of the calculated bits in a format identical to that of the input image data.
Problems with conventional digital filters can be further illustrated by considering a case where the filter constant decimal point format is set for a low-pass filter operation. In such cases, the filter constant f is set to a small value (e.g., 0.7) and other filter constants are likewise set to values having some decimal fraction. When a digital filter having such filter constants is used with data configured as shown in FIG. 3, only 2 decimal places to the right of point P will remain following any operation. Any further decimal places to the right of P will be dropped from the resulting calculated bits. Such operations with such filter constants produce inaccurate results.
A primary application of low-pass filter operation to image data processing is the production of a smooth image. To this end, each filter constant must usually be as small as the calculated data being represented. Therefore, in a digital filter used in a low-pass filter operation, the decimal point is placed such that the filter constants can be represented by as many decimal places to the right of point P as are required to ensure the accuracy of their representation.
For example, FIG. 4 is a diagram of calculated data showing the filter operation using such filter constants as are required to represent such data to an accuracy of 7 decimal places. Reference characters A to D, S, and P correspond to those in FIG. 3. In each filter constant there is only a sign bit at the left of the decimal point, while there are 7 digits allocated at the right thereof so that a small value can be represented with a high degree of accuracy. Thus, the low-pass filter operation can be performed accurately.
However, if a digital filter with preset low-pass filter constants were applied to a high-pass filter operation in which the filter constant f requires a large value, the value of f could not be accurately represented due to lack of digits allocated at the left of the decimal point. As a result, the high-pass filter operation could not be accurately performed.
As described above, a conventional digital filter with a fixed decimal point format for the respective filter constants is limited as to the type of filter operation or processing that the digital filter can accurately perform.